package pe.com.tma.model;

import java.io.Serializable;
import java.sql.Timestamp;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Transient;


@Entity
@NamedQueries({
  @NamedQuery(name = "Cotizacion.findAll", query = "select o from Cotizacion o")
})
public class Cotizacion  implements Serializable{

    private Double antcot;
    @Column(length = 10)
    private String antfec;
    private Double apecot;
    private Long cantneg;
    @Id
    @Column(nullable = false, length = 12)
    private String codigo;
    private Double comcot;
    @Id
    @Column(nullable = false)
    private Timestamp fecha;
    private Double maxcot;
    private Double mincot;
    private Double montefe;
    private Long numoper;
    private Double procot;
    private Double ultcot;
    private Double varcot;
    private Double vencot;
    
    @Transient
    private String strFecha;
    
    @Transient
    private Date dfecha;

    public Cotizacion() {
    }

    public Cotizacion(Double antcot, String antfec, Double apecot, Long cantneg,
                    String codigo, Double comcot, Timestamp fecha,
                    Double maxcot, Double mincot, Double montefe, Long numoper,
                    Double procot, Double ultcot, Double varcot,
                    Double vencot) {
        this.antcot = antcot;
        this.antfec = antfec;
        this.apecot = apecot;
        this.cantneg = cantneg;
        this.codigo = codigo;
        this.comcot = comcot;
        this.fecha = fecha;
        this.maxcot = maxcot;
        this.mincot = mincot;
        this.montefe = montefe;
        this.numoper = numoper;
        this.procot = procot;
        this.ultcot = ultcot;
        this.varcot = varcot;
        this.vencot = vencot;
    }

	public Double getAntcot() {
		return antcot;
	}

	public void setAntcot(Double antcot) {
		this.antcot = antcot;
	}

	public String getAntfec() {
		return antfec;
	}

	public void setAntfec(String antfec) {
		this.antfec = antfec;
	}

	public Double getApecot() {
		return apecot;
	}

	public void setApecot(Double apecot) {
		this.apecot = apecot;
	}

	public Long getCantneg() {
		return cantneg;
	}

	public void setCantneg(Long cantneg) {
		this.cantneg = cantneg;
	}

	public String getCodigo() {
		return codigo;
	}

	public void setCodigo(String codigo) {
		this.codigo = codigo;
	}

	public Double getComcot() {
		return comcot;
	}

	public void setComcot(Double comcot) {
		this.comcot = comcot;
	}

	public Timestamp getFecha() {
		return fecha;
	}

	public void setFecha(Timestamp fecha) {
		this.fecha = fecha;
	}

	public Double getMaxcot() {
		return maxcot;
	}

	public void setMaxcot(Double maxcot) {
		this.maxcot = maxcot;
	}

	public Double getMincot() {
		return mincot;
	}

	public void setMincot(Double mincot) {
		this.mincot = mincot;
	}

	public Double getMontefe() {
		return montefe;
	}

	public void setMontefe(Double montefe) {
		this.montefe = montefe;
	}

	public Long getNumoper() {
		return numoper;
	}

	public void setNumoper(Long numoper) {
		this.numoper = numoper;
	}

	public Double getProcot() {
		return procot;
	}

	public void setProcot(Double procot) {
		this.procot = procot;
	}

	public Double getUltcot() {
		return ultcot;
	}

	public void setUltcot(Double ultcot) {
		this.ultcot = ultcot;
	}

	public Double getVarcot() {
		return varcot;
	}

	public void setVarcot(Double varcot) {
		this.varcot = varcot;
	}

	public Double getVencot() {
		return vencot;
	}

	public void setVencot(Double vencot) {
		this.vencot = vencot;
	}

	public String getStrFecha() {
		Format fmt;
		
		fmt =  new SimpleDateFormat("dd/MM/yyyy");
		strFecha = fmt.format(new Date(this.fecha.getTime()));
		
		return strFecha;
	}

	public void setStrFecha(String strFecha) {
		this.strFecha = strFecha;
	}

	@SuppressWarnings("deprecation")
	public Date getDfecha() {
		
		dfecha = new Date(this.fecha.getDate());
		return dfecha;
	}

	public void setDfecha(Date dfecha) {
		this.dfecha = dfecha;
	}
	
	
}
